package com.weige.elefence.dto;

/**
 * @author ltj
 * @Description 返回包装
 * @date 2022/5/24
 */
@SuppressWarnings("all")
public class R {
    private Integer code;
    private String msg;

    public R(Integer code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public static R success() {
        return new R(200, "ok");
    }

    public static R error(String error) {
        return new R(10000, error);
    }

    public static R error(Integer code, String error) {
        return new R(code, error);
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    @Override
    public String toString() {
        return "R{" +
                "code=" + code +
                ", msg='" + msg + '\'' +
                '}';
    }
}
